﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using StudentManage.Data;

namespace StudentManage.Web.Personal
{
    public partial class checkon : SecurityPage
    {
        public string GetRemun(string strRemun)
        {
            string str = "";
            try { str = UtilityUI.Decode(strRemun); }catch{}
            return str;
        }

        private void RepBing()
        {
            UserList md = (UserList)Session["UserMD"];
            var eps = DynamicLinqExpressions.True<WorkRecord>();
            eps = eps.And(p => p.Userid == md.id);
            eps = eps.And(p => p.IsDel == false);

            int RowCount = LinqUtility.LinqContext.WorkRecord.Where(eps).Count();
            this.AspNetPager1.RecordCount = RowCount;
            int PageSize = this.AspNetPager1.PageSize;
            int SkipCount = PageSize * (this.AspNetPager1.CurrentPageIndex - 1);

            List<WorkRecord> WorkRecordlist = LinqUtility.LinqContext.WorkRecord.Where(eps).OrderByDescending(p => p.AddTime).Skip(SkipCount).Take(PageSize).ToList();
            this.RepWorkList.DataSource = WorkRecordlist;
            this.RepWorkList.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (Session["UserMD"] != null)
                this.RepBing();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            this.RepBing();
        }
    }
}